-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark main and serverAssert as weak symbols to be overridden #1232
base: unstable
Are you sure you want to change the base?
Conversation
Signed-off-by: Madelyn Olson <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #1232 +/- ##
============================================
+ Coverage 70.54% 70.55% +0.01%
============================================
Files 114 114
Lines 63144 63144
============================================
+ Hits 44543 44554 +11
+ Misses 18601 18590 -11
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
@@ -83,7 +83,7 @@ jobs: | |||
steps: | |||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |||
- name: make | |||
run: make -j3 SERVER_CFLAGS='-Werror' | |||
run: make all-with-unit-tests -j3 SERVER_CFLAGS='-Werror' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make flags before the target seems more common style. We do that in other places.
run: make all-with-unit-tests -j3 SERVER_CFLAGS='-Werror' | |
run: make -j3 all-with-unit-tests SERVER_CFLAGS='-Werror' |
@@ -6810,7 +6810,7 @@ serverTestProc *getTestProcByName(const char *name) { | |||
} | |||
#endif | |||
|
|||
int main(int argc, char **argv) { | |||
__attribute__((weak)) int main(int argc, char **argv) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment about why we add this attribute on main?
At some point unit tests stopped building on MacOS because of duplicate symbols. I had originally solved this problem by using a flag that overrides symbols, but the much better solution is to mark the duplicate symbols as weak and they can be overridden during linking. (Symbols by default are strong, strong symbols override weak symbols)
I also added macos unit build to the CI, so that this doesn't silently break in the future again.